package com.oceansoft.core.jxkh.service.impl;

import com.hui.platform.system.exception.HuiException;
import com.oceansoft.core.common.util.Pagination;
import com.oceansoft.core.domain.SysUser;
import com.oceansoft.core.jxkh.dao.IWorkLogDao;
import com.oceansoft.core.jxkh.domain.*;
import com.oceansoft.core.jxkh.service.IWorkLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/10/24.
 */
@Service
public class WorkLogServiceImpl implements IWorkLogService {

    @Resource
    private IWorkLogDao workLogDao;
    @Override
    public Pagination<WorkLog> querybycondition(HashMap<String, String> map, SysUser user) throws HuiException {
        return workLogDao.querybycondition(map,user);
    }

    @Override
    public int saveDailywork(Daliywork daliywork)throws HuiException {
        return workLogDao.saveDailywork(daliywork);
    }

    @Override
    public List<Daliywork> weekDaliywork(HashMap<String, String> map) throws HuiException{
        return workLogDao.weekDaliywork(map);
    }

    @Override
    public int saveWeekwork(WorkLog workLog) throws HuiException{
       return  workLogDao.saveWeekwork(workLog);
    }

    @Override
    public void saveWorkLogContent(WorkLogcontent content)throws HuiException {
        workLogDao.saveWorkLogContent(content);
    }

    @Override
    public List<Map<String, Object>> findLastWeekWork(String policeNum,String type) {
        return workLogDao.findLastWeekWork( policeNum, type);
    }

    @Override
    public List<Map<String, Object>> findLastMonthWork(String policeNum, String type) {
        return workLogDao.findLastMonthWork(policeNum,type);
    }

    @Override
    public List<Daliyworkcontent> dailyWorkContent(String policeNum, String workdate, String type) throws HuiException {
        return workLogDao.dailyWorkContent(policeNum,workdate,type);
    }

    @Override
    public void deleteDailyWorkContent(int dbid) throws HuiException  {
        workLogDao.deleteDailyWorkContent(dbid);
    }

    @Override
    public List<Map<String, Object>> findMonthWork(String policeNum) {
        return workLogDao.findMonthWork(policeNum);
    }

    @Override
    public boolean checkIsAdd(SysUser user, Map<String, String> map) {
        int i = workLogDao.checkIsAdd(user,map);
        if(i>0){
            return false;
        }
        return true;
    }

    @Override
    public Daliywork findDaliyworkByDate(String policeNum, String workdate) {
        return workLogDao.findDaliyworkByDate(policeNum,workdate);
    }

    @Override
    public WorkLog findWorkLog(int dbid) {
        return workLogDao.findWorkLog(dbid);
    }

    @Override
    public List<WorkLogcontent> weekWorkInfo(String policeNum, int dbid) {
        return workLogDao.weekWorkInfo(policeNum,dbid);
    }

    @Override
    public void deleteWeekworkContent(Integer dbid) {
        workLogDao.deleteWeekworkContent(dbid);
    }

    @Override
    public void deleteData(int dbid) {
        workLogDao.deleteData(dbid);
    }

    @Override
    public Ydxj findYdxj(int dbid) {
        return workLogDao.findYdxj(dbid);
    }

    @Override
    public Pagination<Ydxj> wdybList(HashMap<String, String> paramap, SysUser user) {
        return workLogDao.wdybList(paramap,user);
    }

    @Override
    public void saveYdxj(Ydxj ydxj) throws HuiException {
        if(ydxj.getDbid()==Integer.MIN_VALUE){
            workLogDao.saveYdxj(ydxj);
        }else{
            workLogDao.editYdxj(ydxj);
        }

    }

    @Override
    public Ydxj findLastYdxj(String policeNum) {
        return workLogDao.findLastYdxj(policeNum);
    }

    @Override
    public void deleteYdxj(int dbid) {
        workLogDao.deleteYdxj(dbid);
    }

    @Override
    public boolean checkIsAddyb(Map<String, String> map, SysUser user) {
        return workLogDao.checkIsAddyb(map,user);
    }

    @Override
    public List<WorkLog> monthsWeekwork(HashMap<String, String> map) throws HuiException {
        return workLogDao.monthsWeekwork(map);
    }

    @Override
    public void saveDailyworkcontent(Daliyworkcontent content)throws HuiException {
        workLogDao.saveDailyworkcontent(content);
    }

    @Override
    public Pagination<WorkLog> myWorkList(HashMap<String, String> map, SysUser user) {
        return workLogDao.myWorkList(map,user);
    }
}
